#include<stdio.h>
int main()

{
	int a, i, sum, count = 0;
	for (a = 1; a < 1000; a++)
	{
		for (i = 1, sum = 0; i <= a / 2; i++)

			if (a%i == 0)
				sum = sum + i;
		if (sum == a)
		{
			printf("%d\n", a);
			count = count++;
		}
		
	}
	printf("count=%d\n", count);
	return 0;
}